
<form name=formname action="saveforms_IndividualInfo.php" method="POST">

	<table id=approvelist>
		<tbody>
			<tr name="tr1g" >
				<td>
					<input name="checkbox" type=checkbox id=checkbox>
				</td>
				<td>
					<input type="text" name="username" value="" >
				</td>
				<td>
					<input type="text" name="timelimit" value="" >
				</td>
				<td>
					<input type=button name=btn1g onClick="addRow(approvelist,this)"  value="在此行前插入" />
				</td>
			</tr>
		</tbody>
	</table>
	<input type=button name=btn1g onClick="addRow(approvelist,undefined)"  value="在最后添加" />
	<input type=button onClick="deleteRow(approvelist)" value="删除">
	<input name="submit" type="button" value="提交数据" />
	<script>
	<!--
			//-----------------动态表格的函数----------------------
			
			// 添加一行
			// objTable 表名
			// Names 一行中obj的name，数组,要和原来的一致.
			function addRow(objTable,tr) {
				// alert(objTable.id);
			    var tbody = objTable.getElementsByTagName("TBODY")[0];
			    var elm = tbody.firstChild.cloneNode(true);
			 
			 	var temps = elm.all;
			 	for(var i=0;i<temps.length-1;i++){
			 		var temp = temps[i];
			 		if(temp.name=="username" || temp.name=="timelimit")
			 		temp.value="";
			 	}
			  	
			  	if(tr==undefined){
				  	tbody.insertBefore(elm);
				  	return;
				}
				if(tr.parentElement==undefined){
				  	tbody.insertBefore(elm);
				  	return;
				}
			   	var obj = tr.parentElement.parentElement;
			    tbody.insertBefore(elm,obj);
			}
			
			// 删除一行
			function deleteRow(objTable) {
			    var tbody = objTable.getElementsByTagName("TBODY")[0];
			    for (var i = tbody.children.length - 1; i >= 0; i--) {
			        if (tbody.children[i].firstChild.firstChild.checked) {
			            tbody.deleteRow(i);
			        }
			    }
			}
	-->
	</script>

</form>
